package admin

import (
	"context"

	"server-go/api/reward/internal/svc"
	"server-go/api/reward/internal/types"
	"server-go/rpc/reward/types/reward"

	"github.com/zeromicro/go-zero/core/logx"
)

type ChangeAuditLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewChangeAuditLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ChangeAuditLogic {
	return &ChangeAuditLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *ChangeAuditLogic) ChangeAudit(req *types.AdminChangeAuditInput) (resp *types.AdminChangeAuditOutput, err error) {
	out := &types.AdminChangeAuditOutput{}
	res, err := l.svcCtx.RewardRpc.AdminChangeAudit(l.ctx, &reward.AdminChangeAuditInput{Id: req.Id, Audit: req.Audit})
	if err != nil {
		return out, err
	}
	out.Status = res.Status
	out.Msg = res.Msg
	return out, nil
}
